import { _decorator, Component, Node, Sprite, v3, Vec3 } from 'cc';
import { BasePanel } from '../../../../scripts/libs/ui/BasePanel';
import { Observable, of } from 'rxjs';
import { lm } from '../../LobbyManager';
const { ccclass, property } = _decorator;

@ccclass('ResourceFakePanel')
export class ResourceFakePanel extends BasePanel {

    @property(Node)
    topNode: Node = null;

    @property(Sprite)
    heartIconSprite: Sprite = null;

    @property(Sprite)
    coinIconSprite: Sprite = null;

    willBind(): void {
        this.adaptive();
    }

    afterOpen(): Observable<string> {
        this.coinIconSprite.node.getWorldPosition(lm.uiRoot._fly_coin_target_worldpos); // 为飞金币动画提供目标信息
        return of(null);
    }

    adaptive() {
        this.topNode.setScale(v3(Vec3.ONE).multiplyScalar(lm.getAdaptiveScale()));
    }

}

